<?php
include_once 'checkAdmin.php';
include_once 'conn.php';
$id = $_GET['id'];
if(empty($id) || !is_numeric($id) || $id <= 0){
    echo "<script>alert('参数错误');history.back();</script>";
    exit;
}
$sql ="delete from userinfo where id = $id";
$result = mysqli_query($conn,$sql);
//echo mysqli_errno($conn);

if(!mysqli_errno($conn)){  //成功执行，返回的错误代码为0
    echo "<script>alert('删除成功');location.href = 'admin.php';</script>";
}
else{
    echo "<script>alert('删除失败');history.back();</script>";
}
